package operation;

import book.BookList;

import java.util.Scanner;

public class BorrowOperation implements Operation {
    public void work(BookList list) {
        System.out.println("借阅图书...");
        System.out.println("请输入要借阅的书名：");
        Scanner sc = new Scanner(System.in);
        String borrowName = sc.nextLine();
        int currentsize = list.getSizeUsed();
        for (int i = 0; i < currentsize; i++) {
            if (borrowName.equals(list.getBook(i).getBookName())) {
                list.getBook(i).setBorrowed(true);
                System.out.println("借阅成功！！！");
                return;
            }
        }
        System.out.println("没有找到这本书!!!");
    }
}
